<template>
  <div class="body">
    <el-form ref="ruleForm" :model="mdl" :inline="true" label-width="130px">
      
        <el-form-item label="房间标签" required>
          <el-input
            v-model="mdl.labelName"
            placeholder="请输入房间标签"
          />
        </el-form-item>
      
    </el-form>
    <div class="foot_btn">
      <el-button
        type="primary"
        :loading="submitLoading"
        @click="submitForm('ruleForm')"
      >提交</el-button>
      <el-button @click="handleCloseDrawer">取消</el-button>
    </div>
  </div>
</template>

<script>
import { addRoomLabel,updateRoomLabel } from '@/api/user'
export default {
  name: 'FormModel',
  props: {
    mdl: {
      type: Object,
      required: true
    },
    handleCloseDrawer: {
      type: Function,
      required: true
    }
  },
  data() {
    return {
      submitLoading: false,
      fileList: [],
      uploadData: null,
      imgList: [],
      channelList:[],
      relaysChannels:[],
     
      relaysId:''
    }
  },
  mounted() {
    

    
    
  },
  methods: {
    

    // 提交
    submitForm() {
      const request = this.mdl.id ? updateRoomLabel(this.mdl) : addRoomLabel(this.mdl)
      request.then((res) => {
        if (res.statusCode === '00000') {
          this.$message({ message: '提交成功', type: 'success' })
          // 关闭弹窗
          this.handleCloseDrawer()
          // 调用父级组件刷新数据
          this.$emit('getList')
        }
      })
        .catch((error) => {
          console.log(error)
        })
        .finally(() => {
        })
    }
  }
}
</script>

<style lang="less" scoped>
.body {
  padding-right: 25px;
  .foot_btn{
    width:150px;
    margin: 0 auto;
  }
}

/deep/ .el-checkbox__label {
  font-size: 12px;
}
</style>
